﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>分时段问候用户</title>
    <script type="text/javascript">
        now = new Date();
        hour = now.getHours();
        if(hour < 6){
            document.write("欢迎光临，凌晨好");
        }else if(hour < 9){
            document.write("欢迎光临，早上好");
        }else if(hour < 12){
            document.write("欢迎光临，上午好");
        }else if(hour < 14){
            document.write("欢迎光临，中午好");
        }else if(hour < 17){
            document.write("欢迎光临，下午好");
        }else if(hour <19){
            document.write("欢迎光临，傍晚好");
        }else if(hour < 22){
            document.write("欢迎光临，晚上好");
        }else{
            document.write("欢迎光临，午夜好");
        }
    </script>
</head>
<body>

</body>
</html>